package com.bauer.base.io.nio;

import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @Author ：rui.wei
 * @Date ：Created in 11:44 2019/7/15
 * @Description：
 */
public class NetNioClientDemo {

    public static void main(String[] args) throws Exception {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("127.0.0.1", 8088));
        ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
        byteBuffer.put("hello nio server".getBytes());

        byteBuffer.flip();
        socketChannel.write(byteBuffer);
//        byteBuffer.clear();
//        socketChannel.close();
    }

}
